// DlgProxy.cpp : implementation file
//

#include "stdafx.h"
#include "SmartPlay.h"
#include "DlgProxy.h"
#include "SmartPlayDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// CSmartPlayDlgAutoProxy

IMPLEMENT_DYNCREATE(CSmartPlayDlgAutoProxy, CCmdTarget)

CSmartPlayDlgAutoProxy::CSmartPlayDlgAutoProxy()
{
	EnableAutomation();
	
	// To keep the application running as long as an automation 
	//	object is active, the constructor calls AfxOleLockApp.
	AfxOleLockApp();

	// Get access to the dialog through the application's
	//  main window pointer.  Set the proxy's internal pointer
	//  to point to the dialog, and set the dialog's back pointer to
	//  this proxy.
	ASSERT_VALID(AfxGetApp()->m_pMainWnd);
	if (AfxGetApp()->m_pMainWnd)
	{
		ASSERT_KINDOF(CSmartPlayDlg, AfxGetApp()->m_pMainWnd);
		if (AfxGetApp()->m_pMainWnd->IsKindOf(RUNTIME_CLASS(CSmartPlayDlg)))
		{
			m_pDialog = reinterpret_cast<CSmartPlayDlg*>(AfxGetApp()->m_pMainWnd);
			m_pDialog->m_pAutoProxy = this;
		}
	}
}

CSmartPlayDlgAutoProxy::~CSmartPlayDlgAutoProxy()
{
	// To terminate the application when all objects created with
	// 	with automation, the destructor calls AfxOleUnlockApp.
	//  Among other things, this will destroy the main dialog
	if (m_pDialog != NULL)
		m_pDialog->m_pAutoProxy = NULL;
	AfxOleUnlockApp();
}

void CSmartPlayDlgAutoProxy::OnFinalRelease()
{
	// When the last reference for an automation object is released
	// OnFinalRelease is called.  The base class will automatically
	// deletes the object.  Add additional cleanup required for your
	// object before calling the base class.

	CCmdTarget::OnFinalRelease();
}

BEGIN_MESSAGE_MAP(CSmartPlayDlgAutoProxy, CCmdTarget)
END_MESSAGE_MAP()

BEGIN_DISPATCH_MAP(CSmartPlayDlgAutoProxy, CCmdTarget)
END_DISPATCH_MAP()

// Note: we add support for IID_ISmartPlay to support typesafe binding
//  from VBA.  This IID must match the GUID that is attached to the 
//  dispinterface in the .IDL file.

// {F324263F-2C1C-4821-BFFA-9CCD06BDD98A}
static const IID IID_ISmartPlay =
{ 0xF324263F, 0x2C1C, 0x4821, { 0xBF, 0xFA, 0x9C, 0xCD, 0x6, 0xBD, 0xD9, 0x8A } };

BEGIN_INTERFACE_MAP(CSmartPlayDlgAutoProxy, CCmdTarget)
	INTERFACE_PART(CSmartPlayDlgAutoProxy, IID_ISmartPlay, Dispatch)
END_INTERFACE_MAP()

// The IMPLEMENT_OLECREATE2 macro is defined in StdAfx.h of this project
// {8DC93FC6-0EDA-47EA-88E6-62726136DA06}
IMPLEMENT_OLECREATE2(CSmartPlayDlgAutoProxy, "SmartPlay.Application", 0x8dc93fc6, 0xeda, 0x47ea, 0x88, 0xe6, 0x62, 0x72, 0x61, 0x36, 0xda, 0x6)


// CSmartPlayDlgAutoProxy message handlers
